package cn.edu.zut.internship.web.controller.teach;

import cn.edu.zut.internship.bean.sys.ErrorCodeEnum;
import cn.edu.zut.internship.bean.sys.Result;
import cn.edu.zut.internship.bean.sys.SysUser;
import cn.edu.zut.internship.iservice.student.StudentSV;
import cn.edu.zut.internship.iservice.teach.TeachSV;
import cn.edu.zut.internship.web.utils.UserInfoUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/teach")
public class TeachController {
    @Reference
    TeachSV teachSV;
    @RequestMapping("/getTeachDetail")
    public Result getTeachDetail(@RequestBody Map params){
        Result result = new Result();
        result = teachSV.getTeachById(params);
        return result;
    }

    /**
     * 学生获取指导老师信息
     * @param
     * @return
     */
    @RequestMapping("/getMyTeach")
    public Result getMyTeach(){
        Result result = new Result();
        SysUser userInfo = UserInfoUtil.getUserInfo();
        String userAccount = userInfo.getUserAccount();
        result = teachSV.getMyTeach(userInfo.getUserAccount());
        return result;
    }
}
